<?php
/**
 * @package Framework
 * @subpackage Controls
 */

/**
 * Creates a mouseover popup box
 * 鼠标经过过出现提示标签，在系统日程表中有体现
 * @package Framework
 * @subpackage Controls
 * @desc 实际上就是将构造函数中的三个参数作为 js中overlib的参数，实现提示标签的效果。标签的显示分为两部分，一个是标题就是$caption，一个是显示的主体内容$text
 * 	     
 * @access public
 */

class tooltip
{
	var $show_command = '';
	var $hide_command = 'return nd();'; // Clears popups if appropriate
	
	function tooltip($text, $caption='', $options='')
	{
		if ($text != '')
    {
      $this->show_command = 'return overlib(\''.addslashes(htmlspecialchars($text)).'\'';

      if ($caption != '')
      {
				$this->show_command .= ',CAPTION, \''.addslashes(htmlspecialchars($caption)).'\'';
      }
      if ($options != '')
      {
				$this->show_command .= ','.$options;
      }
      $this->show_command .= ');';
    }
	}
	
  function get_header()
  {
    global $GO_CONFIG, $GO_THEME;
	// ol = overlib
    return '<script type="text/javascript" src="'.$GO_CONFIG->control_url.'overlibmws/overlibmws.js"></script>'.
      "<script type=\"text/javascript\">OLpageDefaults(".
      "TEXTFONTCLASS,'olFont',FGCLASS,'olForeground',BGCLASS,'olBackground',CGCLASS,'olCBackground',".
      "CAPTIONFONTCLASS,'olCaptionFont', CLOSEFONTCLASS, 'olCaptionFont', HAUTO, VAUTO,DELAY, 250);</script>".
      '<link href="'.$GO_THEME->theme_url.'css/overlib.css" type="text/css" rel="stylesheet" />';
  }
}
